﻿using ConfExpert.Forms.Base;
using DevTeam;

using System;
namespace ConfExpert.Forms.Depo.Aksesuar
{
    public partial class DeletedBrands : XForm
    {
        public DeletedBrands()
        {
            InitializeComponent();
        }

        private void DeletedBrands_Load(object sender, EventArgs e)
        {
            gridView1.Init("GetAksesuarOfDeletedBrands");
            gridView1.AddDetailGrid(gridView2, "BrandId");

            gridView1.AddColumn("FarkliAksesuar", typeof(int), "COUNT(Child({FK}).AksesuarId)");

            gridView1.MakeColumnInvisible("BrandId", "CustomerId");
            gridView2.MakeColumnInvisible("BrandId", "CustomerId", "StokKod", "Lokasyon", "ReorderPoint");

            gridView1.FormatAsNumber(0, "FarkliAksesuar");
            gridView1.AddSummary("FarkliAksesuar");
            gridView2.FormatAsNumber(0, "RaftakiMiktar");
            gridView2.AddSummary("RaftakiMiktar");

            gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect;
            splitContainerControl1.AutoSize();
            gridView1.FocusedRowChanged += gridView1_FocusedRowChanged;

            gridView1.BestFitColumns();
            gridView2.BestFitColumns();
        }

        void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            txtInfo.Caption = gridView1.GetRowCellDisplayText(e.FocusedRowHandle, "Brand");
            gridView2.BestFitColumns();
        }
    }
}
